#include<REG51.H>
unsigned char i = 0;

void init() 
{
    TMOD = 0X01;
    TH0 = (65536 - 50000)/256;
    TL0 = (65536 - 50000)%256;
    EA = 1;
    ET0 = 1;
    TR0 =  1;
}

void  main()
{
    init();
    P1 = 0xfe;
    while(1);
}

void timer() interrupt 1
{
    TH0 = (65536 - 50000)/256;
    TL0 = (65536 - 50000)%256;
    i++;
    if (i == 20)
    {
        i = 0;
        P1 = (P1<<1|P1>>7);
    }
    
}